<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace Plugin\Alarm\Http\Request\Admin;

use Hyperf\Validation\Request\FormRequest;

/**
 * 广播记录验证数据类
 */
class RdAlarmBroadcastRecordRequest extends FormRequest
{
    /**
     * 场景配置
     */
    protected array $scenes = [
        'index' => [
            'id', 'file_id', 'second', 'device', 'type', 'start_time', 'end_time', 'created_by', 'updated_by', 'created_at', 'updated_at'
        ],
        'create' => [
            'file_id','second','device','type','start_time','end_time'
        ],
        'update' => [
            'file_id','second','device','type','start_time','end_time'
        ]
    ];

    public function authorize(): bool
    {
        return true;
    }


    /**
     * 新增数据验证规则
     * return array
     */
    public function rules(): array
    {
        return [
            'id' => 'integer|min:1',
            'ids' => 'array|min:1',
            'ids.*' => 'integer|min:1',
            
            'file_id' => 'integer',
            'second' => 'numeric',
            'device' => 'array',
            'type' => 'integer|in:1,2',
            'start_time' => 'integer',
            'end_time' => 'integer',
            'created_by' => 'integer|min:1',
            'updated_by' => 'integer|min:1',
        ];
    }


    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'id' => '主键ID',
            'file_id' => '文件id',
            'second' => '秒',
            'device' => '广播id',
            'type' => '类型 1:广播 2:喊话',
            'start_time' => '开始时间',
            'end_time' => '结束时间',
            'created_by' => '创建者',
            'updated_by' => '更新者',
        ];
    }

public function messages(): array
{
    return [
            'id.required' => '必填主键ID',
            'device.required' => '必填广播',
            'type.required' => '必填类型',

    ];
}
}